package com.sandy.gorm6

import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class MyController {

    @RequestMapping("/{manufacturerName}/vehicles")
    List<String> vehiclesByManufacturer(@PathVariable String manufacturerName) {
        Vehicle.list(offset:2, max:2, sort:'name', order:'asc')
    }

    @RequestMapping("/{manufacturerName}/vehicles")
    List<String> findByWhere(@PathVariable String manufacturerName) {
        Vehicle.where{
            year == 1996
        }.find()
    }
}
